package com.xugongzhang.tx.dao;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author X
 * @date 2022/12/11 2:48
 */
@Repository
@Slf4j
public class UserDao {
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    
    public void insert() {
        String sql = "INSERT INTO user\n" +
                "(name, email, age)\n" +
                "VALUES(?, ?, ?)\n";
        int update = jdbcTemplate.update(sql, "Yue", "my wife", 18);
        log.info("插入了 {} 条数据", update);
    }
}
